package com.xhwl.logistics.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.HashMap;
import java.util.Map;

@Getter
@AllArgsConstructor
public enum VehicleParkingLotStatisticsHandlerEnum {

    VEHICLE_PARKINGLOT_NOTHING(-1, "vehicleParkingLotNothingStatisticsHandlerImpl"),
    VEHICLE_PARKINGLOT_KETOP(3, "vehicleParkingLotKeTopStatisticsHandlerImpl");

    private final Integer productId;

    private final String statisticsHandlerName;

    private static final Map<Integer, VehicleParkingLotStatisticsHandlerEnum> map;
    static {
        map = new HashMap<>();
        for (VehicleParkingLotStatisticsHandlerEnum vehicleParkingLotStatisticsHandlerEnum : VehicleParkingLotStatisticsHandlerEnum.values()) {
            map.put(vehicleParkingLotStatisticsHandlerEnum.getProductId(), vehicleParkingLotStatisticsHandlerEnum);
        }
    }

    public static VehicleParkingLotStatisticsHandlerEnum toVehicleParkingLotStatisticsHandlerEnum(Integer productId) {
        for (VehicleParkingLotStatisticsHandlerEnum vehicleParkingLotStatisticsHandlerEnum : VehicleParkingLotStatisticsHandlerEnum.values()) {
            if (vehicleParkingLotStatisticsHandlerEnum.productId.equals(productId)) {
                return vehicleParkingLotStatisticsHandlerEnum;
            }
        }
        return VEHICLE_PARKINGLOT_NOTHING;
    }

}
